package com.zhouixi.service;

import com.alibaba.fastjson.JSONObject;
import jakarta.annotation.Resource;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Service;


// 消息确认服务
@Service
public class MessageAckService {
    @Resource
    private RocketMQTemplate rocketMQTemplate;
    @Resource
    private MessageStorageService storageService;

    // 发送已读回执
    public void sendReadAck(String msgId, String receiverId) {
        JSONObject ack = new JSONObject();
        ack.put("type", "READ_ACK");
        ack.put("msgId", msgId);
        ack.put("receiverId", receiverId);
        rocketMQTemplate.convertAndSend("im_ack_topic", ack.toJSONString());
    }


}